package luoxuan.admin.dao;

import java.util.List;

import org.springframework.orm.hibernate5.support.HibernateDaoSupport;

import luoxuan.admin.entity.Admin;

public class AdminDao extends HibernateDaoSupport {

	public Admin login(Admin admin) {
		String hql = "from Admin admin where admin.username=? and admin.password=?";
		List<Admin> list = (List<Admin>) this.getHibernateTemplate().find(hql, admin.getUsername(),
				admin.getPassword());
		if (list != null && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}

}
